#include<string>
using namespace std;
class Solution {
public:
    int longestPalindrome(string s) {
        int nums[100] = { 0 };
        for (int i = 0; i < s.size(); i++)nums[s[i] - 'A']++;
        int ret = 0, flag = 0;
        for (int i = 0; i < 100; i++) {
            if (nums[i] % 2 == 0)ret += nums[i];
            else {
                flag = 1;
                ret += nums[i] - 1;
            }
        }
        if (flag)ret += 1;
        return ret;
    }
};